﻿using MengLin.OOP.DesignPattern.FlyWeightPattern.BasicCode.Abstract;
using MengLin.OOP.DesignPattern.FlyWeightPattern.BasicCode.Factory;
using MengLin.OOP.DesignPattern.FlyWeightPattern.BasicCode.Implements;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MengLin.OOP.DesignPattern.FlyWeightPattern.BasicCode
{
    class Program
    {
        static void Main(string[] args)
        {
            int extrinsicstate = 22;

            //享元工厂
            FlyweightFactory flyweightFactory = new FlyweightFactory();

            AbstractFlyweight fx = flyweightFactory.GetFlyweight("X");
            fx.Operation(--extrinsicstate);

            AbstractFlyweight fy = flyweightFactory.GetFlyweight("Y");
            fy.Operation(--extrinsicstate);

            AbstractFlyweight fz = flyweightFactory.GetFlyweight("Z");
            fz.Operation(--extrinsicstate);

            UnsharedConcreteFlyweight uf = new UnsharedConcreteFlyweight();

            uf.Operation(--extrinsicstate);

            Console.Read();
        }
    }
}
